import qs from "qs";
import  { baseURL } from "./http";
import axios from 'axios';

const axiosInstance = axios.create({
  baseURL,
  timeout: 10000, //设置超时时间和跨域是否允许携带凭证
  transformRequest: data => qs.stringify(data),
  validateStatus: status => /^(2|3)\d{2}$/.test(String(status)),
});

export const uploadImg = async (file: any): Promise<any> => {
  const result = await axiosInstance.post(`${baseURL}/upload`, {
    file,
  });
  return result;
}
     